import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 * @throws BinarySearchTreeException
	 */
	public static void main(String[] args) {

		BinarySearchTree tree = new BinarySearchTree();

		for (int i = 1; i < 20; i++) {

			try {
				tree.addValue((int) (Math.random() * 50));
			} catch (BinarySearchTreeException e) {
			}

		}

		System.out.println(tree.toString());
		Scanner scan = new Scanner(System.in);
		System.out.println(tree.hasValue(Integer.parseInt(scan.next())));

	}

}
